
package com.netease.xone.itemview;

import protocol.meta.InfoPraise;
import Utils.TimeFormatUtil;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.netease.xone.R;
import com.netease.xone.view.ProfileView;

public class RenderDetailPraiseView {
    
    private ProfileView image;
    private TextView name;
    private TextView time;
    private View line;
    
    public RenderDetailPraiseView(View v) {
        image = (ProfileView)v.findViewById(R.id.image);
        name = (TextView)v.findViewById(R.id.name);
        time = (TextView)v.findViewById(R.id.time);
        line = v.findViewById(R.id.line);
    }

    public void renderView(final Context context, final InfoPraise praise, boolean last) {
        String value = null;
        
        image.setImageUrl(praise.getUser().getUserAttr(), praise.getUser().getAvatar());
        value = praise.getUser().getNickname();
        value += " 称赞了这篇讨论";
        name.setText(value);
        time.setText(TimeFormatUtil.getTimeFormat(context, praise.getTime()));
        line.setVisibility(last ? View.GONE : View.VISIBLE);
    }
}
